package com.agent.course.mapper;

import com.agent.course.param.ClassParam;
import com.agent.course.vo.TeacherClassVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.mybatis.spring.annotation.MapperScan;

import java.util.List;

public interface ClassMapper{

    @Insert("insert into class(classId,className,userId,classAvatar) values(#{classId},#{className},#{userId},#{classAvatar})")
    int addClass(ClassParam classParam);

    @Select("select count(*) from class where classId=#{classid}")
    int countByClassId(String classId);

    @Select("select classId,className,number,createTime,classAvatar from class where userId=#{userId} order by createTime asc")
    List<TeacherClassVO> getTeacherClasses(String userId);

    @Select("select classId,className,number,createTime,classAvatar from class where classId=#{classId}")
    TeacherClassVO getStudentClasses(String classId);

}
